package bao;

public class ShopDealAgency implements IDeal{
    private ShopDeal deal;

    public ShopDealAgency(ShopDeal deal) {
        this.deal = deal;
    }
    public String find(String id){
        return deal.find(id);
    }
    public String findAll(){
        try {
            return deal.findAll();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    public int add(Shop s){
        if(deal.find(s.getId())==null)
            return deal.add(s);
        return 0;
    }
    @Override
    public int update(Shop s) {
        if(deal.find(s.getId())==null)
            return 0;
        return deal.update(s);
    }

    @Override
    public int delete(String id) {
        if(deal.find(id)==null)
            return 0;
        return deal.delete(id);
    }
}
